import hasPermission from '../utils/permission';

export default function authDirective(Vue) {
  Vue.directive('auth', {
    bind: function bind(el, binding) {
      if (!hasPermission(binding.value)) {
        el.parentNode && el.parentNode.removeChild(el);
      }
    },
  });
}
